package com.hh.ListNodeQuestions;



/**
 * @Author hanghao
 * @Date 2023/6/27 14:02
 * @Version 1.0
 * easy
 * 反转链表                  (递归函数系列)
 */

public class No206 {
    public ListNode reverseList(ListNode head) {
        if (head == null) return head;
        ListNode pre = null;
        ListNode cur = head;
        while (cur != null) {
            ListNode temp = cur.next;
            cur.next = pre;
            pre = cur;
            cur = temp;
        }
        return pre;
    }
}


